﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>正在调入单据请稍候...</title>
    <meta http-equiv="Access-Control-Allow-Origin" content="*" />
    <script type="text/javascript" src="../Scripts/QueryString.js"></script>
    <script type="text/javascript" src="../Scripts/jquery-1.7.2.min.js"></script>
    <!-- 导入配置文件. -->
    <!-- 该文件可以被集成厂商自己定义风格,可以自己修改,以达到流程设计器与自己的系统风格统一. -->
    <link href="../../DataUser/Style/ccbpm.css" rel="Stylesheet" />
    <script type="text/javascript" src="../Scripts/config.js"  ></script>
    <script type="text/javascript" src="../Comm/Gener.js" ></script>
    <script type="text/javascript">

        $(function () {

            var ap = GetQueryString("AP");

            var strs = ap.split('$');
            var frmID = ap[0]; //表单ID.
            var paras = strs[1].split('_');

            //alert(paras);
            var workid = paras[0];
            var flowNo = paras[1];
            var nodeID = paras[2];
            var starter = paras[3];
            var deptNo = paras[4];

            //校验是否正确.
            var gwf = new Entity("BP.WF.GenerWorkFlow", workid);

            if (gwf.FK_Flow != flowNo || gwf.FK_Dept != deptNo || gwf.Starter != starter) {
                alert('参数错误：' + window.location.href);
                return;
            }

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
            handler.AddPara("FK_Node", nodeID);
            handler.AddPara("WorkID", workid);
            handler.AddPara("FK_Flow", flowNo);

            var data = handler.DoMethodReturnString("PrintDocQRGuide_Init");
            //alert(data);

            var urls = JSON.parse(data);

            var html = "";

            for (var i = 0; i < urls.length; i++) {
                var url = urls[i];

                //alert(url.No);

                if (url.No == "pdf") {

                    if (url.Name.indexOf('err@') == 0) {
                        html += "<fieldset>";
                        html += "<legend>pdf 生成pdf出现错误</legend>";
                        html += "<font color=red>" + url.Name + "</font>";
                        html += "</fieldset>";
                    } else {
                        html += "<fieldset>";
                        html += "<legend>pdf 在线打印与预览</legend>";
                        html += "<ul>";
                        html += "<li>系统把整个表单生成了一个pdf文件.</li>";
                        html += "<li>点击这里<a href=" + url.Name + " target=_blank ><img src='../Img/FileType/pdf.gif' />进行下载与在线预览</a></li>";
                        html += "</ul>";
                        html += "</fieldset>";
                        downloadFile(url.Name);
                    }
                }
            }

        });

        function downloadFile(url) {
            window.open(url);
            return;
        }

    </script>

</head>
<body>


正在调入单据请稍候.....

</body>
</html>
